import request from '@/utils/request';

// 分页获取商品信息
export function getPageAttribute(query) {
  return request({
    url: '/codeworld-goods/attribute/get-page-attribute',
    method: 'post',
    data: query
  })
}
// 更新商品状态 1--上架 0--下架
export function updateProductStatus(id,status) {
  return request({
    url: '/codeworld-goods/product/update-product-status',
    method: 'post',
    params: { id,status }
  })
}

// 新增属性
export function addAttribute(form) {
  return request({
    url: '/codeworld-goods/attribute/add-attribute',
    method: 'post',
    data: form
  })
}

export function deleteAttribute(id) {
  return request({
    url: '/codeworld-goods/attribute/delete/' + id,
    method: 'delete'
  });
}

export function getAttributeByCategoryId(categoryId) {
  return request({
    url: '/codeworld-goods/attribute/get-by-categoryId/' + categoryId,
    method: 'get'
  });
}
